package com.ftg.learn.test1;

import java.util.Random;

/**
 * 练习1
 *
 * 随机生成一组长度为10的整数数组并计算平均数
 *
 * @author lijiaxin
 * @version 1.0
 * @date 2023/7/29 16:56
 */

public class Test1_1 {

    public static void main(String[] args) {
        int[] arr=new int[10];
        int sum=0;
        int avg=0;
        for (int i = 0; i < 10; i++) {
            Random random=new Random();
            arr[i]=random.nextInt(10);
        }
        for (int i = 0; i < arr.length; i++) {
             sum+=arr[i];
            System.out.print(arr[i]);
        }
        avg=sum/arr.length;
        System.out.println( "平均数："+avg);
    }
}
